package com.ieasy.module.system.web.action;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ieasy.basic.model.DataGrid;
import com.ieasy.basic.model.Msg;
import com.ieasy.basic.util.cons.Const;
import com.ieasy.module.common.web.action.BaseController;
import com.ieasy.module.system.service.IDeptInfoCategoryService;
import com.ieasy.module.system.web.form.DeptInfoCategoryForm;

@Controller
@RequestMapping("/admin/system/deptinfo_category")
public class DeptInfoCategoryAction extends BaseController {

	@Autowired
	private IDeptInfoCategoryService deptinfoCategoryService ;
	
	@RequestMapping("/deptinfo_catetory_main_UI.do")
	public String deptinfo_item_main_UI(){
		return  Const.SYSTEM + "deptinfo_catetory_main_UI" ;
	}
	
	@RequestMapping("/deptinfo_catetory_form_UI.do")
	public String deptinfo_catetory_form_UI(DeptInfoCategoryForm form, Model mode){
		if(null != form.getId() && !"".equals(form.getId())) {
			mode.addAttribute("id", form.getId()) ;
		}
		return Const.SYSTEM + "deptinfo_catetory_form_UI" ;
	}
	
	@RequestMapping("/deptinfo_m_catetory_main_UI.do")
	public String deptinfo_m_catetory_main_UI(){
		return  Const.SYSTEM + "deptinfo_m_catetory_main_UI" ;
	}
	
	@RequestMapping("/deptinfo_m_catetory_form_UI.do")
	public String deptinfo_m_catetory_form_UI(DeptInfoCategoryForm form, Model mode){
		if(null != form.getId() && !"".equals(form.getId())) {
			mode.addAttribute("id", form.getId()) ;
		}
		return Const.SYSTEM + "deptinfo_m_catetory_form_UI" ;
	}
	
	@RequestMapping("/doNotNeedAuth_deptinfo_view.do")
	public String deptinfo_view(){
		return  Const.SYSTEM + "deptinfo_view" ;
	}
	
	@RequestMapping("/doNotNeedAuth_deptinfo_view_root.do")
	public String deptinfo_view_root(){
		return  Const.SYSTEM + "deptinfo_view_root" ;
	}
	
	@RequestMapping("/get.do")
	@ResponseBody
	public DeptInfoCategoryForm get(DeptInfoCategoryForm form){
		return this.deptinfoCategoryService.get(form) ;
	}
	
	@RequestMapping("/add.do")
	@ResponseBody
	public Msg add(DeptInfoCategoryForm form){
		return this.deptinfoCategoryService.add(form) ;
	}
	
	@RequestMapping("/update.do")
	@ResponseBody
	public Msg edit(DeptInfoCategoryForm form){
		return this.deptinfoCategoryService.update(form) ;
	}
	
	@RequestMapping("/delete.do")
	@ResponseBody
	public Msg delete(DeptInfoCategoryForm form){
		return this.deptinfoCategoryService.delete(form) ;
	}

	@RequestMapping("/datagrid.do")
	@ResponseBody
	public DataGrid datagrid(DeptInfoCategoryForm form){
		return this.deptinfoCategoryService.datagrid(form) ;
	}
	
	
	@RequestMapping("/getCategoryList.do")
	@ResponseBody
	public List<DeptInfoCategoryForm> getCategoryList(){
		return this.deptinfoCategoryService.getCategoryList() ;
	}

	@RequestMapping("/getCategoryByDept.do")
	@ResponseBody
	public List<DeptInfoCategoryForm> getCategoryByDept(String deptid){
		return this.deptinfoCategoryService.getCategoryByDept(deptid) ;
	}
	
}
